<?php
/**
 * Created by PhpStorm.
 * User: yellow
 * Date: 2019/5/22
 * Time: 10:54
 */

namespace app\admin\controller;


use app\admin\logic\BusBrandLogic;
use think\facade\Request;

class BusBrand extends Base
{
    private $busBrandLogic;

    public function __construct()
    {
        parent::__construct();
        $this->busBrandLogic = new BusBrandLogic();
    }

    public function index(){
        return $this->fetch();
    }


    public function ajaxIndex(){
        $data = Request::param();
        $brandList = $this->busBrandLogic->brandList($data, self::$nowPage);
        return json($brandList);
    }

    public function add(){
        $act = 'add';
        $id = Request::param('id');
        if ($id){
            $brandInfo = $this->busBrandLogic->brandInfo($id);
            $this->assign('info', $brandInfo['data']);
            $act = 'edit';
        }
        $this->assign('act', $act);
        return $this->fetch();
    }

    public function handle(){
        $data = Request::param();
        $res = $this->busBrandLogic->handle($data);
        return json($res);
    }

}